//
//  LWBasicTbController.m
//  豆瓣
//
//  Created by 刘伟 on 16/7/6.
//  Copyright © 2016年 刘伟. All rights reserved.
//
#import "LWBasicNvController.h"
#import "LWFilmController.h"
#import "LWBasicTbController.h"
#import "LWCityController.h"
#import "LWMeController.h"
@interface LWBasicTbController ()

@end

@implementation LWBasicTbController

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置title颜色
    [[UITabBar appearance]setTintColor:[UIColor grayColor]];
    //添加子控制器
    [self addChildViewController];

}
-(void)addChildViewController{
    
    NSArray *buttonImages = @[@"tabbar_discover", @"tabbar_mainframe", @"tabbar_contacts",@"tabbar_me"];
    NSArray *buttonImagesSelected = @[@"tabbar_discoverHL", @"tabbar_mainframeHL", @"tabbar_contactsHL",@"tabbar_meHL"];
    LWCityController * city = [[LWCityController alloc]init];
    
    [self addChildViewController:city title:@"同城" image:buttonImages[0] selectedImage:buttonImagesSelected[0]];
    
    LWFilmController *nearbyVC = [[LWFilmController alloc] init];
    [self addChildViewController:nearbyVC title:@"电影" image:buttonImages[1] selectedImage:buttonImagesSelected[1]];
    
    LWMeController *meVC = [[LWMeController alloc] init];
    [self addChildViewController:meVC title:@"我" image:buttonImages[3] selectedImage:buttonImagesSelected[3]];
    

 

}
-(void)addChildViewController:(UIViewController *)childController title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage{
    childController.title = title;
    childController.tabBarItem.image = [[UIImage imageNamed:image] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
   LWBasicNvController * na = [[LWBasicNvController alloc]initWithRootViewController:childController];
    childController.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [self addChildViewController:na];
     
    


}


@end
